var express = require('express');
var app = express();
var fs = require("fs");

app.get("/dbctrl/listRepositories", function (request, response) {

    fs.readFile("./data/sqlRepositories.json", 'utf8', function (err, data) {
        response.writeHead(200,{'Content-Type':'application/json;charset=utf-8'});//设置response编码为utf-8
        response.end(data);
    });
});

app.get('/listUsers', function (req, res) {
    fs.readFile("./data/users.json", 'utf8', function (err, data) {
        res.end(data);
    });
});

var server = app.listen(8080, function () {
    var port = server.address().port;
    console.log("应用实例，访问地址为 http://127.0.0.1:%s", port)
});